package com.gs.wechatdemo.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

import com.gs.wechatdemo.R;

import java.util.ArrayList;
import java.util.List;

public abstract class BaseListActivity<D> extends Activity {
    protected List<D> list;
    protected RecyclerView recyclerView;
    protected int offset = 0, limit = 20;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        list = new ArrayList<>();
        recyclerView = fd(R.id.recyclerView);
        initView();
        initData();
    }

    protected abstract int getLayoutId();

    protected abstract void initView();

    protected abstract void initData();

    protected abstract void loadData();

    protected <I extends View> I fd(int id) {
        return findViewById(id);
    }

}
